/*
 * Copyright 2006 Berry Crawford
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.judo.generate.java;

import org.judo.generate.CodeGenerator;
import org.judo.generate.GenerationException;

public class InterfaceGenerator extends ClassGenerator
{
	public String generate()
		throws GenerationException
	{
		String classCode = "";
		
		if (packageName != null)
			classCode += "package "+packageName+";\n\n";
		
		for (int i=0;i<imports.size();i++)
		{
			classCode += "import "+imports.get(i)+";\n";
		}
		
		if (imports.size() > 0)
			classCode += "\n";
			
		classCode += "public interface "+className+" ";
		
		if (superClass != null)
			classCode += "extends "+superClass+" ";
		
		boolean first = true;
		
		classCode += "\n{\n";
		
		
		if (fields.size() > 0)
			classCode += "\n";
		
		for (int i=0;i<methods.size();i++)
		{
			CodeGenerator method = (CodeGenerator)methods.get(i);
			((Method) method).setGenerateBody(false);
			classCode += method.generate();
		}
		
		classCode += "}\n";
			
		return classCode;
	}	
}
